package logic

import (
	"context"

	"worker/sse/internal/svc"
	"worker/sse/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type GetClientIdByGroupLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewGetClientIdByGroupLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetClientIdByGroupLogic {
	return &GetClientIdByGroupLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *GetClientIdByGroupLogic) GetClientIdByGroup(req *types.GetClientIdByGroupReq) (resp *types.GetClientIdByGroupResp, err error) {
	resp = &types.GetClientIdByGroupResp{
		ClientIds: make([]string, 0),
	}
	resp.ClientIds = l.svcCtx.SSE.GetClientIdByGroup(req.GroupId)
	return resp, nil
}
